import React from "react";
class ListCom extends React.Component {
    constructor() {
        super()
        this.state={
            list:[{id:1,title:"北京欢迎您"},{id:2,title:"山东欢迎您"}]
        }
    }
    update=(val)=>{
       return ()=>{
           console.log(val);
         }
    }
    render() {
        return (
            <div>list
                <ul>
                    {
                        this.state.list.map((item,index)=>(
                        <li key={item.id}> 
                            {item.title}
                            <div><button onClick={this.update(index)}>修改</button></div>
                        </li>
                        ))
                    }
                </ul>
            </div>
        )
    }
}

export default ListCom